import time

from selenium.webdriver.common.by import By
from selenium import webdriver
from Po126_0903.Page import Page
import pytest
import unittest
from ddt import ddt,file_data
#pytest
# @pytest.fixture(scope='class')
# def driver() -> None:
#     driver=webdriver.Firefox()
#     driver.maximize_window()
#     yield driver
#     time.sleep(5)
#     driver.quit()
#
#
# def test_126_01(driver):
#
#     po = Page(driver)
#     po.open_url('https://www.126.com/')
#     time.sleep(5)
#     po.kj()
#     po.username()
#     po.password()
#     po.anniu()
#     po.frame_content()
#     time.sleep(3)
#     po.xiexin()
#     po.youxiang()
#     po.zhuti()
#     po.fasong()


#unittest
@ddt()
class test_126(unittest.TestCase):
    def setUp(self)->None:
        self.driver=webdriver.Firefox()
        self.driver.maximize_window()

    def tearDown(self)->None:
        time.sleep(3)
        self.driver.quit()
    @file_data(r'D:\gao1\PythonProject4\Po126_0903\yaml126.yaml')
    def test_126_login(self,username,password):
        po=Page(self.driver)
        po.luoji_126_login(username=username,password=password)
        # po.open_url('https://www.126.com/')
        # time.sleep(5)
        # po.kj()
        # po.username()
        # po.password()
        # po.anniu()
        # po.frame_content()
        # time.sleep(3)
        # po.xiexin()
        # po.youxiang()
        # po.zhuti()
        # po.fasong()
